﻿using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using élénkPróbája.results;

namespace élénkPróbája.Test.extention
{
    public static class TestExtensions
    {
        public static void ShouldEqual(this object actual, object expected)
        {
            Assert.AreEqual(expected, actual);
        }

        public static void ShouldBeTheSameAs(this object actual, object expected)
        {
            Assert.AreSame(expected, actual);
        }

        public static void ShouldBeNull(this object actual)
        {
            Assert.IsNull(actual);
        }

        public static void ShouldNotBeNull(this object actual)
        {
            Assert.IsNotNull(actual);
        }

        public static void ShouldBeTrue(this bool b)
        {
            Assert.IsTrue(b);
        }

        public static void ShouldBeTrue(this bool b, string msg)
        {
            Assert.IsTrue(b, msg);
        }

        public static void ShouldBeFalse(this bool b)
        {
            Assert.IsFalse(b);
        }

        public static T ShouldBe<T>(this object actual)
        {
            Assert.IsInstanceOfType(actual,typeof (T));
            return (T)actual;
        }

        public static bool IsValid(this IEnumerable<ValidationFailure> errors)
        {
            return errors.Count() == 0;
        } 
    }
}